var childView = (function($) {
	var locId= '';
	var sourceData = [];
	var pageIndex = 1,limit = 50;
	var dateArgStr = '';
	var upPullElement = null;
	var isPulling = false;

	$.init({
		swipeBack: false, //启用右滑关闭功能
		
	});
	if(!mui.os.plus) {
		baseSetup();	
	}
	mui.plusReady(function() {
		baseSetup();
		var scrolls = document.querySelectorAll('.mui-slider-group .mui-scroll')
		mui.each(scrolls,function(index, pullRefreshEl){
			mui(pullRefreshEl).pullToRefresh({
				up: {
					callback: function() {
						upPullElement = this;
						getOperateData();
					}
				}
			});
		});
		mui('#slider').slider().stopped = true; //禁止左右滑动
		resetPullRefresh(dateArgStr);
	});

	function getOperateData(){
		if (isPulling == true) {
			return;
		}
		isPulling = true;
		plus.nativeUI.showWaiting('正在查询',{modal:false});
		var pdict = {'startDate':dateArgStr,'endDate':dateArgStr,'userDeptID':locId}
		var paramDict = {'method':'OPER.APP.Utils.Schedule:FindOperScheduleList',
			'params':JSON.stringify(pdict),'type':'Query'}
		mui.DHCWebService(paramDict, function(result) {
			//console.log(JSON.stringify(result));
			plus.nativeUI.closeWaiting();
			try {
				var dataArr = result.data;
				dealResponseData(dataArr);
			} catch(e) {
				mui.toast('服务器数据不合法');
				if(upPullElement != null) {
					upPullElement.endPullUpToRefresh(false);
				}
				isPulling = false;
				return;
			}
		}, function(error) {
			mui.toast(error);
			plus.nativeUI.closeWaiting();
			if(upPullElement!=null){
				upPullElement.endPullUpToRefresh(false);
			}
			isPulling = false;
		});
		// plus.nativeUI.closeWaiting();
		// dataArr = [{'patname':'王*云','oproom':'北102','opordno':'7','sex':'女','age':'61岁','diag':'黄斑前膜','opname':'上睑下垂矫正术；','operpartstr':'双侧','opdoc':'刘小伟','anmethod':'局部麻醉','andoc':'','anDocAss':'','xsh':',秦维佳','xch':',&nbsp;','opmem':'102-07','Stat':'R'},{'patname':'文*','oproom':'北102','opordno':'10','sex':'男','age':'33岁','diag':'眼睑肿物','opname':'显微镜下角膜拆线；','operpartstr':'(R)右侧','opdoc':'刘小伟','anmethod':'局部麻醉','andoc':'','anDocAss':'','xsh':',秦维佳','xch':',&nbsp;','opmem':'102-10','Stat':'R'},{'patname':'陈*花','oproom':'北103','opordno':'5','sex':'女','age':'69岁','diag':'白内障','opname':'白内障超声乳化吸除+人工晶状体植入术；','operpartstr':'右眼','opdoc':'卞爱玲,王尔茜,','anmethod':'局部麻醉','andoc':'','anDocAss':'','xsh':',宋雪园','xch':',刘鹏','opmem':'103-5&nbsp;晶体待定','Stat':'R'},{'patname':'张*亭','oproom':'北103','opordno':'14','sex':'男','age':'65岁','diag':'双眼抗青光眼术后','opname':'青光眼滤过泡修补术；','operpartstr':'左眼','opdoc':'程钢炜,张扬,','anmethod':'局部麻醉','andoc':'','anDocAss':'','xsh':',宋雪园','xch':',刘鹏','opmem':'103-14&nbsp;滤过泡手术','Stat':'R'},{'patname':'张*飞','oproom':'北103','opordno':'15','sex':'男','age':'44岁','diag':'可疑青光眼','opname':'青光眼滤过泡修补术；','operpartstr':'左眼','opdoc':'程钢炜,张扬,','anmethod':'局部麻醉','andoc':'','anDocAss':'','xsh':',宋雪园','xch':',刘鹏','opmem':'103-14&nbsp;滤过泡手术','Stat':'R'},{'patname':'任*晋','oproom':'北103','opordno':'16','sex':'女','age':'24岁','diag':'左眼抗青光眼术后','opname':'青光眼滤过泡修补术；','operpartstr':'左眼','opdoc':'程钢炜,张扬,','anmethod':'局部麻醉','andoc':'','anDocAss':'','xsh':',宋雪园','xch':',刘鹏','opmem':'103-15&nbsp;滤过泡手术','Stat':'R'},{'patname':'张*红','oproom':'北103','opordno':'19','sex':'女','age':'49岁','diag':'黄斑水肿','opname':'玻璃体腔穿刺术；','operpartstr':'右眼','opdoc':'张扬','anmethod':'局部麻醉','andoc':'','anDocAss':'','xsh':',宋雪园','xch':',刘鹏','opmem':'103-18&nbsp;IVR','Stat':'R'},{'patname':'段*','oproom':'北105','opordno':'5','sex':'女','age':'25岁','diag':'子宫肌瘤','opname':'腹腔镜探查备开腹子宫肌瘤剔除备扩大&nbsp;；','operpartstr':'不涉及','opdoc':'赵峻,张志博,','anmethod':'全身麻醉','andoc':'裴丽坚','anDocAss':'','xsh':'&nbsp;高秀清','xch':',丛昱杭','opmem':'105-5&nbsp;百克&nbsp;工作站&nbsp;或&nbsp;超声刀&nbsp;备开腹器械','Stat':'R'},{'patname':'刘*艳','oproom':'北105','opordno':'6','sex':'女','age':'48岁','diag':'卵巢癌复发','opname':'再次肿瘤细胞减灭术&nbsp;；','operpartstr':'不涉及','opdoc':'王涛,王永学,王艳芳,','anmethod':'全身麻醉','andoc':'桑诺尔','anDocAss':'','xsh':'&nbsp;高秀清','xch':',丛昱杭','opmem':'107-3&nbsp;备超声刀，百克，肝拉钩，动脉，血管器械（腹主）','Stat':'R'},{'patname':'钟*秀','oproom':'北106','opordno':'5','sex':'女','age':'49岁','diag':'卵巢癌','opname':'中间型肿瘤细胞减灭术&nbsp;；','operpartstr':'不涉及','opdoc':'王涛,王永学,康佳,','anmethod':'全身麻醉','andoc':'张志永','anDocAss':'','xsh':'&nbsp;郭岳斌','xch':',高洁','opmem':'107-4&nbsp;超声刀，百克，肝拉钩，动脉，备ICU','Stat':'R'},{'patname':'刘*明','oproom':'北202','opordno':'1','sex':'男','age':'61岁','diag':'脑胶质母细胞瘤','opname':'开颅左额叶占位探查切除术&nbsp;；','operpartstr':'(L)左侧','opdoc':'王裕,马文斌,王雅宁,','anmethod':'全身麻醉','andoc':'田园','anDocAss':'','xsh':'&nbsp;肖颖','xch':',魏杨','opmem':'请排202-2，术中核磁、神经导航、术中超声，动脉监测，CUSA，cellsaver，滴水双极','Stat':'R'},{'patname':'翟*','oproom':'北202','opordno':'2','sex':'男','age':'50岁','diag':'脑转移','opname':'神经导航、术中超声辅助左额叶占位切除术&nbsp;；','operpartstr':'(L)左侧','opdoc':'王裕,王雅宁,马文斌,','anmethod':'全身麻醉','andoc':'','anDocAss':'','xsh':'&nbsp;肖颖','xch':',魏杨','opmem':'请排202第3台，备双极、神经导航、术中超声，Cellsaver，动脉监测，谢谢。','Stat':'R'},{'patname':'马*纵','oproom':'北203','opordno':'4','sex':'男','age':'74岁','diag':'','opname':'下肢动脉造影,球囊扩张,备支架植入术&nbsp;；','operpartstr':'双侧','opdoc':'叶炜,宋小军,','anmethod':'复合麻醉','andoc':'田园','anDocAss':'','xsh':'&nbsp;徐晨','xch':',韩子为','opmem':'','Stat':'R'},{'patname':'陈*枝','oproom':'北204','opordno':'2','sex':'女','age':'59岁','diag':'肝占位','opname':'腹腔镜探查，左肝联合肝段切除术&nbsp;；','operpartstr':'不涉及','opdoc':'郑永昌,张磊,杨晓波,万雪帅,','anmethod':'全身麻醉','andoc':'','anDocAss':'','xsh':'&nbsp;张进军','xch':',王文玥','opmem':'204-2，备3D腹腔镜、超声刀、腔镜超声，谢谢！','Stat':'R'},{'patname':'陈*','oproom':'北204','opordno':'3','sex':'女','age':'63岁','diag':'肝占位','opname':'剖腹探查，左肝联合肝段切除术&nbsp;；','operpartstr':'不涉及','opdoc':'郑永昌,杨晓波,张磊,万雪帅,','anmethod':'全身麻醉','andoc':'','anDocAss':'','xsh':'&nbsp;张进军','xch':',王文玥','opmem':'204-3，备肝拉钩、滴水双极、超声刀、CUSA，谢谢！','Stat':'R'},{'patname':'余*千','oproom':'北205','opordno':'3','sex':'女','age':'53岁','diag':'卵巢癌','opname':'肿瘤细胞减灭术；','operpartstr':'不涉及','opdoc':'赵峻,李玲,李源,冯鹏辉,','anmethod':'全身麻醉','andoc':'谭骁','anDocAss':'','xsh':'&nbsp;王一亦','xch':',贾晓珊','opmem':'205-3&nbsp;肝拉钩，百克，工作站，超声刀&nbsp;*中心/动脉&nbsp;唐山天恩吸烟电烧&nbsp;HBV+','Stat':'R'},{'patname':'项*','oproom':'北206','opordno':'1','sex':'女','age':'33岁','diag':'妊娠状态','opname':'剖宫取子术&nbsp;；','operpartstr':'不涉及','opdoc':'宋亦军,陈欣,朱珊,','anmethod':'椎管内麻醉','andoc':'谭骁','anDocAss':'','xsh':',曹梦楠','xch':'&nbsp;黄薇,高洁','opmem':'请排206-1，07:30早开台，谢谢','Stat':'R'},{'patname':'王*慧','oproom':'北208','opordno':'5','sex':'女','age':'31岁','diag':'子宫平滑肌瘤','opname':'宫腔镜子宫肌瘤剔除+腹腔镜卵巢囊肿剔除术，备腹腔镜肌瘤剔除&nbsp;；','operpartstr':'','opdoc':'孙智晶,戴毓欣,郭载欣,','anmethod':'全身麻醉','andoc':'陆海松','anDocAss':'','xsh':'&nbsp;王建梅,&nbsp;','xch':',冯海峤','opmem':'208-6，摄普乐，备肌瘤钻','Stat':'R'},{'patname':'董*','oproom':'北209','opordno':'3','sex':'女','age':'56岁','diag':'直肠癌','opname':'腹腔镜直肠癌前切除（Dixon）术；','operpartstr':'不涉及','opdoc':'周皎琳,韦颍昕,王一澄,','anmethod':'全身麻醉','andoc':'张良燕','anDocAss':'','xsh':',郭赛辉','xch':',黄鸿伟','opmem':'周皎琳教授非手术加台-1，请接209后，请备3D腹腔镜、强生超声刀、一次性扁头双极，谢谢！','Stat':'R'},{'patname':'孟**','oproom':'北210','opordno':'2','sex':'女','age':'24岁','diag':'垂体生长激素瘤','opname':'经鼻蝶窦鞍区占位病变切除+鞍底重建术&nbsp;；','operpartstr':'不涉及','opdoc':'冯铭,李智敏,','anmethod':'全身麻醉','andoc':'袁堂谧','anDocAss':'','xsh':',丁东阁','xch':',周俊志','opmem':'请排210第2台，备内镜,&nbsp;谢谢！','Stat':'R'},{'patname':'贾*立','oproom':'北210','opordno':'5','sex':'男','age':'35岁','diag':'肢端肥大症','opname':'经鼻蝶窦鞍区占位病变切除+鞍底重建术&nbsp;；','operpartstr':'不涉及','opdoc':'姚勇,邓侃,','anmethod':'全身麻醉','andoc':'袁堂谧','anDocAss':'','xsh':',丁东阁','xch':',周俊志','opmem':'请排210第5台，备内镜,&nbsp;谢谢！','Stat':'R'},{'patname':'王*博','oproom':'北210','opordno':'7','sex':'男','age':'57岁','diag':'鞍区病变','opname':'经鼻蝶窦鞍区占位病变切除+鞍底重建术&nbsp;；','operpartstr':'不涉及','opdoc':'邓侃,姚勇,','anmethod':'全身麻醉','andoc':'袁堂谧','anDocAss':'','xsh':',丁东阁','xch':',周俊志','opmem':'请排210第7台，备内镜,&nbsp;谢谢！','Stat':'R'},{'patname':'王*','oproom':'北211','opordno':'3','sex':'女','age':'38岁','diag':'股骨干骨折','opname':'左股骨干骨折切开复位内固定术&nbsp;；','operpartstr':'(L)左侧','opdoc':'高鹏,常晓,','anmethod':'全身麻醉','andoc':'袁堂谧','anDocAss':'','xsh':'&nbsp;唐蕊','xch':',高畅','opmem':'骨科5-3，术中透视','Stat':'R'},{'patname':'管*文','oproom':'北211','opordno':'4','sex':'女','age':'67岁','diag':'外伤','opname':'右转子间闭合复位内固定，右桡骨远端骨折切开复位内固定术&nbsp;；','operpartstr':'(R)右侧','opdoc':'高鹏,常晓,','anmethod':'全身麻醉','andoc':'袁堂谧','anDocAss':'','xsh':'&nbsp;唐蕊','xch':',高畅','opmem':'骨科5-4，牵引床，术中透视','Stat':'R'},{'patname':'易*华','oproom':'北212','opordno':'2','sex':'女','age':'37岁','diag':'垂体生长激素瘤','opname':'经鼻蝶窦鞍区占位病变切除+鞍底重建术&nbsp;；','operpartstr':'不涉及','opdoc':'幸兵,李智敏,','anmethod':'全身麻醉','andoc':'李敏娜','anDocAss':'','xsh':'&nbsp;孙旭','xch':',吴敏','opmem':'请排212第2台，备显微镜,&nbsp;谢谢！','Stat':'R'},{'patname':'温*君','oproom':'北212','opordno':'3','sex':'女','age':'40岁','diag':'库欣综合征','opname':'经鼻蝶窦鞍区占位病变切除+鞍底重建术&nbsp;；','operpartstr':'不涉及','opdoc':'幸兵,李智敏,','anmethod':'全身麻醉','andoc':'李敏娜','anDocAss':'','xsh':'&nbsp;孙旭','xch':',吴敏','opmem':'请排212第3台，备显微镜,导航三爪，谢谢！','Stat':'R'},{'patname':'麻*荣','oproom':'北212','opordno':'4','sex':'女','age':'55岁','diag':'鞍区病变','opname':'经鼻蝶窦鞍区占位病变切除+鞍底重建术&nbsp;；','operpartstr':'不涉及','opdoc':'幸兵,李智敏,','anmethod':'全身麻醉','andoc':'李敏娜','anDocAss':'','xsh':'&nbsp;孙旭','xch':',吴敏','opmem':'请排212第4台，备显微镜,&nbsp;谢谢！','Stat':'R'},{'patname':'王*芝','oproom':'北212','opordno':'6','sex':'女','age':'68岁','diag':'鞍区病变','opname':'经鼻蝶窦鞍区占位病变切除+鞍底重建术&nbsp;；','operpartstr':'不涉及','opdoc':'连伟,李智敏,','anmethod':'全身麻醉','andoc':'李敏娜','anDocAss':'','xsh':'&nbsp;孙旭','xch':',吴敏','opmem':'请排212第6台，备显微镜,&nbsp;谢谢！','Stat':'R'},{'patname':'于*','oproom':'北213','opordno':'5','sex':'男','age':'35岁','diag':'鼻中隔偏曲','opname':'经鼻内镜鼻中隔偏曲三线减张术；','operpartstr':'不涉及','opdoc':'查洋,奥登苏日塔,朱真真,','anmethod':'全身麻醉','andoc':'李敏娜','anDocAss':'','xsh':'&nbsp;刘洁,&nbsp;','xch':',&nbsp;','opmem':'213-5','Stat':'R'},{'patname':'李*丰','oproom':'北213','opordno':'6','sex':'男','age':'50岁','diag':'鼻腔肿物','opname':'经鼻内镜鼻腔肿物切除术；','operpartstr':'(L)左侧','opdoc':'查洋,奥登苏日塔,朱真真,','anmethod':'全身麻醉','andoc':'李敏娜','anDocAss':'','xsh':'&nbsp;刘洁,&nbsp;','xch':',&nbsp;','opmem':'213-6','Stat':'R'},{'patname':'邱*雪','oproom':'北214','opordno':'2','sex':'女','age':'53岁','diag':'甲状腺占位病变','opname':'甲状腺癌根治术；','operpartstr':'不涉及','opdoc':'刘跃武','anmethod':'全身麻醉','andoc':'李天佳','anDocAss':'','xsh':',孙畅&nbsp;张彤','xch':',胡欣','opmem':'请排刘跃武教授手术日第2台，谢谢','Stat':'R'},{'patname':'刘*梅','oproom':'北214','opordno':'3','sex':'女','age':'37岁','diag':'甲状腺占位病变','opname':'甲状腺癌根治术；','operpartstr':'不涉及','opdoc':'刘跃武,王先泽,','anmethod':'全身麻醉','andoc':'李天佳','anDocAss':'','xsh':',孙畅&nbsp;张彤','xch':',胡欣','opmem':'请排刘跃武教授手术日第3台谢谢','Stat':'R'},{'patname':'贾*涵','oproom':'北214','opordno':'7','sex':'女','age':'34岁','diag':'','opname':'甲状腺癌根治术；','operpartstr':'不涉及','opdoc':'刘跃武,王先泽,董良博,','anmethod':'全身麻醉','andoc':'李天佳','anDocAss':'','xsh':',孙畅&nbsp;张彤','xch':',胡欣','opmem':'请排刘跃武教授手术日第7台，侧方，备神经监测，谢谢','Stat':'R'},{'patname':'栗*云','oproom':'北214','opordno':'8','sex':'女','age':'55岁','diag':'','opname':'甲状腺癌根治术；','operpartstr':'不涉及','opdoc':'刘跃武,王先泽,董良博,','anmethod':'全身麻醉','andoc':'李天佳','anDocAss':'','xsh':',孙畅&nbsp;张彤','xch':',胡欣','opmem':'请排刘跃武教授手术日第8台，备神经监测，谢谢','Stat':'R'},{'patname':'王*','oproom':'北215','opordno':'3','sex':'女','age':'37岁','diag':'子宫平滑肌瘤','opname':'腹腔镜子宫肌瘤剔除术&nbsp;；','operpartstr':'不涉及','opdoc':'史宏晖,曹杨,','anmethod':'全身麻醉','andoc':'李天佳','anDocAss':'','xsh':',史云萍&nbsp;张彤','xch':',吴欢','opmem':'215-3，ERAS，静脉麻醉，备单孔，&nbsp;5孔PORT&nbsp;30°镜头&nbsp;','Stat':'R'},{'patname':'原*星','oproom':'北215','opordno':'4','sex':'女','age':'36岁','diag':'粘膜下平滑肌瘤','opname':'宫腔镜粘膜下肌瘤切除术&nbsp;；','operpartstr':'不涉及','opdoc':'史宏晖,曹杨,','anmethod':'全身麻醉','andoc':'李天佳','anDocAss':'','xsh':',史云萍&nbsp;张彤','xch':',吴欢','opmem':'215-4','Stat':'R'},{'patname':'王*兰','oproom':'北216','opordno':'3','sex':'女','age':'49岁','diag':'鼻咽肿物','opname':'经鼻内镜鼻咽肿物切除术；','operpartstr':'(L)左侧','opdoc':'王剑,金晓峰,崔婷婷,牛燕燕,','anmethod':'全身麻醉','andoc':'徐庆','anDocAss':'','xsh':'&nbsp;刘建俊','xch':'','opmem':'216-4','Stat':'R'},{'patname':'孙*歌','oproom':'北217','opordno':'4','sex':'女','age':'31岁','diag':'子宫肌瘤','opname':'单孔腹腔镜子宫肌瘤剔除术&nbsp;；','operpartstr':'不涉及','opdoc':'任常,郭载欣,','anmethod':'全身麻醉','andoc':'刘红菊','anDocAss':'','xsh':',胡涛','xch':',黄晓璐','opmem':'217-4，博后手术日第4台','Stat':'R'},{'patname':'王*竹','oproom':'北218','opordno':'9','sex':'女','age':'17岁','diag':'脉络膜脱离','opname':'玻璃体腔穿刺术；','operpartstr':'(R)右侧','opdoc':'程钢炜,王尔茜,周艳,','anmethod':'局部麻醉','andoc':'','anDocAss':'','xsh':'&nbsp;曹瑀荻','xch':'&nbsp;王贺莹,王贺莹','opmem':'218-09','Stat':'R'},{'patname':'王*平','oproom':'北219','opordno':'7','sex':'女','age':'62岁','diag':'白内障','opname':'白内障超声乳化吸除+人工晶状体植入术；','operpartstr':'(L)左侧','opdoc':'陈哲,王尔茜,','anmethod':'局部麻醉','andoc':'徐庆','anDocAss':'','xsh':',彭程辉','xch':',郑一','opmem':'219-08','Stat':'R'},{'patname':'马*','oproom':'北219','opordno':'8','sex':'男','age':'60岁','diag':'玻璃体出血','opname':'经结膜微创玻璃体切除术；','operpartstr':'(L)左侧','opdoc':'戴荣平,陈哲,钱宇婧,','anmethod':'局部麻醉','andoc':'徐庆','anDocAss':'','xsh':',彭程辉','xch':',郑一','opmem':'219-09','Stat':'R'},{'patname':'周*珠','oproom':'北220','opordno':'3','sex':'女','age':'35岁','diag':'慢性中耳炎','opname':'显微镜下乳突根治+鼓室探查+鼓室成形+备听力重建&nbsp;；','operpartstr':'(L)左侧','opdoc':'高志强,田旭,冯国栋,','anmethod':'全身麻醉','andoc':'刘红菊','anDocAss':'','xsh':',张馨戈','xch':',蔡欣辰','opmem':'220-3&nbsp;&nbsp;台上护士1名，谢谢！','Stat':'R'},{'patname':'孟*冉','oproom':'北301','opordno':'5','sex':'女','age':'34岁','diag':'肾错构瘤','opname':'经腹腔镜肾部分切除术；','operpartstr':'(L)左侧','opdoc':'张玉石,邓建华,郑国洋,','anmethod':'全身麻醉','andoc':'虞雪融','anDocAss':'','xsh':'&nbsp;贺蕾','xch':',张艳丽','opmem':'张玉石教授组-5','Stat':'R'},{'patname':'韩*','oproom':'北301','opordno':'6','sex':'女','age':'49岁','diag':'右输尿管结石','opname':'右侧输尿管软镜钬激光碎石术&nbsp;；','operpartstr':'(R)右侧','opdoc':'刘广华,赵欣,乔逸,','anmethod':'全身麻醉','andoc':'虞雪融','anDocAss':'','xsh':'&nbsp;贺蕾','xch':',张艳丽','opmem':'刘广华教授组非手术日加台，请护士长酌情安排。谢谢，备钬激光','Stat':'R'},{'patname':'王*荣','oproom':'北302','opordno':'4','sex':'男','age':'69岁','diag':'右肾肿物','opname':'经腹腔镜根治性肾切除术；','operpartstr':'(R)右侧','opdoc':'董德鑫,王文达,梁震,','anmethod':'全身麻醉','andoc':'王维嘉','anDocAss':'','xsh':'&nbsp;杨剑锋','xch':',张晓光','opmem':'吴兴成教授组-4，备康基超声刀','Stat':'R'},{'patname':'俞**','oproom':'北302','opordno':'5','sex':'女','age':'55岁','diag':'左肾肿瘤','opname':'经腹腔镜肾部分切除术；','operpartstr':'(L)左侧','opdoc':'董德鑫,王文达,梁震,','anmethod':'全身麻醉','andoc':'王维嘉','anDocAss':'','xsh':',杨剑锋','xch':',张晓光','opmem':'吴兴成教授组-5，备康基超声刀','Stat':'R'},{'patname':'方*家','oproom':'北302','opordno':'6','sex':'男','age':'61岁','diag':'右肾肿物','opname':'经腹腔镜肾部分切除术；','operpartstr':'(R)右侧','opdoc':'董德鑫,王文达,梁震,','anmethod':'全身麻醉','andoc':'王维嘉','anDocAss':'','xsh':',杨剑锋','xch':',张晓光','opmem':'吴兴成教授组-6，备康基超声刀','Stat':'R'},{'patname':'扈*','oproom':'北303','opordno':'4','sex':'女','age':'43岁','diag':'主动脉弓动脉瘤','opname':'主动脉弓动脉瘤腔内修复&nbsp;；','operpartstr':'不涉及','opdoc':'郑月宏,曾嵘,','anmethod':'全身麻醉','andoc':'陈雯','anDocAss':'','xsh':'&nbsp;刁翠翠,&nbsp;','xch':'&nbsp;马文豪','opmem':'郑月宏教授组手术日第4台，请排303-4，谢谢！','Stat':'R'},{'patname':'张*增','oproom':'北304','opordno':'4','sex':'男','age':'56岁','diag':'','opname':'腹腔镜右半结肠癌根治术&nbsp;；','operpartstr':'不涉及','opdoc':'吴斌,陆君阳,','anmethod':'全身麻醉','andoc':'陈雯','anDocAss':'','xsh':'&nbsp;周航','xch':',程明武','opmem':'请排吴斌教授手术日第4台，请备3D&nbsp;Storz腹腔镜，谢谢！','Stat':'R'},{'patname':'张*','oproom':'北304','opordno':'5','sex':'男','age':'82岁','diag':'','opname':'腹腔镜结肠癌根治术&nbsp;；','operpartstr':'不涉及','opdoc':'陆君阳,吴斌,','anmethod':'全身麻醉','andoc':'陈雯','anDocAss':'','xsh':'&nbsp;周航','xch':',程明武','opmem':'请排吴斌教授手术日第5台，请备3D&nbsp;Storz腹腔镜，谢谢！','Stat':'R'},]
		// dealResponseData(dataArr);
	}

	function dealResponseData(dataArr) {
		for(var i = 0; i < dataArr.length; i++) {
			var oneDict = dataArr[i];
			sourceData.push(oneDict);
		}
		var orderCount = dataArr.length;
		var roomStr = '';
		var rowSpan = 1;
		for(var i = sourceData.length - 1; i >= 0; i--) {
			var oneDict = sourceData[i];
			var oneroom = oneDict['RoomDesc']
			oneroom = oneroom==''?'无':oneroom
			if(i == sourceData.length - 1) {
				roomStr = oneroom;
				if (i == 0) {
					sourceData[0]['rowSpan'] = 1;
				}
				continue;
			}
			if(roomStr != oneroom) {
				if(i == 0) {
					sourceData[0]['rowSpan'] = 1;
					sourceData[1]['rowSpan'] = rowSpan;
				} else {
					roomStr = oneroom;
					sourceData[i + 1]['rowSpan'] = rowSpan;
					rowSpan = 1;
				}
				if(i < sourceData.length - orderCount) {
					break;
				}
			} else {
				rowSpan += 1;
				if(i == 0) {
					sourceData[0]['rowSpan'] = rowSpan;
				}
			}
		}
		updateOperateUI(dataArr);
		if(upPullElement != null) {
			upPullElement.endPullUpToRefresh(dataArr.length < limit);
		}
		pageIndex++;
		isPulling = false;
		updateAllWidth();
	}

	function updateOperateUI(dataArr, last) {
		var opTable = document.getElementById('opTable');
		var oldTrs = opTable.querySelectorAll('.normal');
		for (var i = 0; i < dataArr.length;i++) {
			var dict = dataArr[i];
			if (dict == null || dict == "") {
				continue;
			}
			var oproom = dict['RoomDesc']
			oproom = oproom==''?'无':oproom
			var rowspan = dict['rowSpan']
			var tbody = document.getElementById(oproom);
			if (!tbody) {
				tbody = document.createElement('tbody');
				tbody.id = oproom;
				var oldbody = opTable.querySelector('tbody');
				if (oldbody) {
					tbody.innerHTML = '<tr><td class="fengexian" colspan=15 height="10px"></td></tr>'
				}
				opTable.appendChild(tbody);
			}else if (rowspan == null){
				var firstTr = tbody.querySelector('.normal');
				var room = firstTr.querySelector('.room');
				var index = parseInt(firstTr.getAttribute('data-index'));
				var lastDict = sourceData[index] 
				room.setAttribute('rowspan',lastDict['rowSpan']);
			}
			var tr = document.createElement('tr');
			tr.setAttribute('class','normal')
			tr.setAttribute('data-index',(oldTrs.length + i))
			tbody.appendChild(tr);
			
			var html = '';
			if (rowspan != null) {
				html = '<td class="room" rowspan="'+rowspan+'">'+
					dict['RoomDesc']+'</td>';//手术间
			}
			html += '<td class="order">'+dict['OperSeq']+'</td>'+//台次
				'<td class="name">'+dict['PatName']+'</td>'+ //患者姓名
				'<td class="sex">'+dict['PatGender']+'</td>'+//性别
				'<td class="age">'+dict['PatAge']+'</td>'+//年龄
				'<td class="diag">'+dict['PrevDiagnosisDesc']+'</td>'+//术前诊断
				'<td class="opname">'+dict['OperDesc']+'</td>'+//手术名称
				'<td class="oppart">'+dict['BodySiteDesc']+'</td>'+//手术部位
				'<td class="opdoc">'+dict['SurgeonDesc']+'</td>'+//手术医师
				'<td class="anname">'+dict['AnaMethodDesc']+'</td>'+//麻醉方法
				'<td class="andoc">'+dict['AnesthesiologistDesc']+'</td>'+//麻醉医师
				'<td class="anas">'+dict['AnaAssistantDesc']+'</td>'+//麻醉助手
				'<td class="xch">'+dict['ScrubNurseDesc']+'</td>'+//器械护士
				'<td class="xsh">'+dict['CircualNurseDesc']+'</td>'+//巡回护士
				'<td class="opmem">'+dict['OperRequirement']+'</td>';//手术要求
			tr.innerHTML = html;
		}
	}
	
	function updateAllWidth(){
		
		var opTable = document.getElementById("opTable");
		var bodyTr = opTable.querySelector('tr');
		if (bodyTr == null) {
			return
		}
		var bodyTds = bodyTr.querySelectorAll('td');
		var muiScroll = document.getElementById("muiScroll");
		muiScroll.style.width = opTable.clientWidth + 'px';
		var slider = document.getElementById("slider");
		slider.style.width = opTable.clientWidth + 'px';
		var headTable = document.getElementById('headTable');
		headTable.style.width = opTable.clientWidth + 'px';
		var ths = headTable.querySelectorAll('th');
		for (var i = 0; i < bodyTds.length;i++) {
			var bodyTd = bodyTds[i];
			var width = bodyTd.clientWidth + 0.5
			var th = ths[i];
			th.style.width = width + 'px';
		}
	}
	
	function baseSetup(){
		mui('.mui-scroll-wrapper').scroll({
			bounce: false,
			indicators: false, //是否显示滚动条
			deceleration: mui.os.ios ? 0.003 : 0.0009,
//			scrollX: true,
//			bounceX: false
		});

		var perInfo = app.getState()
		if(perInfo) {
			//console.log(JSON.stringify(perInfo));
			locId = perInfo.loginCTLocId; 
		} else {
			mui.toast('用户未登录');
			plus.nativeUI.closeWaiting()
			var state = {};
			app.setState(state);
			localStorage.setItem('$user', JSON.stringify(state));
			plus.runtime.restart(); //重新启动
			return;
		}
		var self = plus.webview.currentWebview()
		dateArgStr = self.dayStr
		mui.back = function() {
			var operationP = plus.webview.getWebviewById('../WKPlatformPages/operation/operationP.html');
			if (operationP) {
				operationP.evalJS('backEvent()')
			}
		}
	}
	function resetPullRefresh(dayStr) {
		dateArgStr = dayStr
		var opTable = document.getElementById('opTable');
		opTable.innerHTML = '';
		pageIndex = 1;
		sourceData.splice(0,sourceData.length);
		mui('#pullrefresh').scroll().scrollTo(0,0,100);
		if(upPullElement != null){
			upPullElement.refresh(true);
		}
		getOperateData();
	}
	var api = {}
	api.refreshPage = resetPullRefresh
	return api;
})(mui);

function reloadChild(dayStr){
	childView.refreshPage(dayStr)
}


/*
 * {'patname':'张*红','oproom':'','opordno':'1','sex':'女','age':'39岁','diag':'子宫肌腺症','opname':'曼月乐环置入术&nbsp;；','operpartstr':'不涉及','opdoc':'樊庆泊,郭琦,李玲,','anmethod':'全身麻醉','andoc':'','anDocAss':'','xsh':',何婕','xch':'&nbsp;李奇玮','opmem':'妇四第一台','Stat':'R'}]

var html = '<colgroup>';
		for (var i = 0; i < bodyTds.length;i++) {
			var bodyTd = bodyTds[i];
			var width = bodyTd.clientWidth + 0.5
//			html += '<col width="'+width+'px">';
			var th = ths[i];
			th.style.width = width + 'px';
		}
		html += '</colgroup><thead><tr><th>手术间</th><th>台次</th><th>姓名</th>'+
			'<th>性别</th><th>年龄</th><th>术前诊断</th><th>手术名称</th><th>手术部位</th>'+
			'<th>术者</th><th>麻醉方法</th><th>麻醉医师</th><th>麻醉助手</th>'+
			'<th>器械护士</th><th>巡回护士</th><th>手术要求</th></tr></thead>';

d ##class(%ResultSet).RunQuery("OPER.APP.Utils.Schedule","FindOperScheduleList","2024-05-08","2024-05-08","","","","","","","","","N","N","N","","","N")
		startDate As %String, endDate As %String, userDeptID As %String, 
		1.开始日期，2.结束日期，3.用户科室ID，4.手术ID，5.申请科室ID
		///                  6.患者病区ID，7.手术状态ID，8.手术间ID，9.登记号，10.病案号
		///                  11：是否日间手术，12：是否门诊手术，13：是否麻醉预约，14：院区Id，15：主刀医生UserId
 */